package entityMapping.demo3;

import entityMapping.demo3.bean.AccountSetting;
import entityMapping.demo3.bean.Computer;
import entityMapping.demo3.bean.Machine;
import entityMapping.demo3.service.AccountService;
import entityMapping.demo3.service.AccountServiceImpl;
import entityMapping.demo3.service.ComputerMachineService;
import entityMapping.demo3.service.ComputerMachineServiceImpl;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

import java.util.List;

public class Main {
    public static void main(String[] args) {
        ApplicationContext context = new FileSystemXmlApplicationContext("conf/beans.xml");

        //ComputerMachineService service = context.getBean(ComputerMachineServiceImpl.class);
        //Computer computer = new Computer(112, "M1", "S1", 0);
        //Machine machine = new Machine(2, "M2");


        AccountService accountService = context.getBean(AccountServiceImpl.class);
        List<AccountSetting> list = accountService.recovery();
        list.forEach(System.out::println);


        AccountSetting accountSetting = list.get(0);
        accountSetting.setFreezePercent(0.6);
        accountService.updateAccountSetting(accountSetting);


        //service.delete(computer);

        //List list1 = service.loadAllComputer();
        //List list2 = service.loadAllMachine();
        //System.out.println();
    }
}
